import { request } from '@/utils/request'
import type { Culture, CultureQuery, PageResult } from '@/types/common'

export const cultureApi = {
  // 获取剪纸文化列表（分页）
  getCulturePage(params: CultureQuery) {
    return request.get<PageResult<Culture>>('/culture/list', { params })
  },

  // 获取剪纸文化详情
  getCultureDetail(id: number) {
    return request.get<Culture>(`/culture/${id}`)
  },

  // 获取推荐文化内容
  getRecommendCultures(limit = 6) {
    return request.get<Culture[]>('/culture/recommend', { 
      params: { limit }
    })
  },

  // 搜索文化内容
  searchCulture(keyword: string, page = 1, size = 10) {
    return request.get<PageResult<Culture>>('/culture/search', {
      params: { keyword, page, size }
    })
  },

  // 获取分类统计
  getCategoryStats() {
    return request.get('/culture/category-stats')
  },

  // 记录浏览
  recordView(id: number) {
    return request.post(`/culture/${id}/view`)
  },

  // 点赞文化内容
  likeCulture(id: number) {
    return request.post(`/culture/${id}/like`, {})
  },

  // 收藏文化内容
  favoriteCulture(id: number) {
    return request.post(`/culture/${id}/favorite`, {})
  },

  // 分享文化内容
  shareCulture(id: number) {
    return request.post(`/culture/${id}/share`)
  },

  // 获取相关文化内容
  getRelatedCultures(id: number, category: number, limit = 5) {
    return request.get<Culture[]>('/culture/related', { 
      params: { id, category, limit } 
    })
  },

  // 获取用户交互状态
  getInteractionStatus(id: number) {
    return request.get(`/culture/${id}/interaction-status`)
  }
}
